﻿<%@ Page Language="C#" MasterPageFile="~/Student/Student.Master" AutoEventWireup="true"
    CodeBehind="ChooseCourse.aspx.cs" Inherits="EngineeringMaster.Student.ChooseCourse"
    Title="硕士生选课" %>

<asp:Content ID="Content1" ContentPlaceHolderID="contentHead" runat="server">
    <style type="text/css">
        div tr td
        {
            font-family: 宋体, Arial, Helvetica, sans-serif;
            font-size: small;
            font-weight: normal;
            font-style: normal;
            font-variant: normal;
            text-transform: none;
            color: #008080;
            border: 1px block #CCCCCC;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentBody" runat="server">
    <link href="../Student.css" rel="stylesheet" type="text/css" />
    <div class="left_side">
        <div class="left_head">
            您已选的课程:
        </div>
        <div class="left_content">
            <div style="position: relative; margin-left: 5px">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="grSelectedCourse" runat="server" AutoGenerateColumns="False" DataKeyNames="CourseID"
                            DataSourceID="SqlDataSource1" Width="481px" Font-Size="Smaller" OnSelectedIndexChanged="grSelectedCourse_SelectedIndexChanged"
                            OnRowCommand="grSelectedCourse_RowCommand" HorizontalAlign="Left" CssClass="operation">
                            <Columns>
                                <asp:BoundField DataField="CourseID" HeaderText="CourseID" ReadOnly="True" SortExpression="CourseID"
                                    Visible="false" />
                                <asp:BoundField DataField="CourseName" HeaderText="课程名" SortExpression="CourseName"
                                    HeaderStyle-Width="200px" ItemStyle-CssClass="cell">
                                    <HeaderStyle Width="200px"></HeaderStyle>
                                    <ItemStyle CssClass="cell"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="CategoryName" HeaderText="课程类别" SortExpression="CategoryName"
                                    HeaderStyle-Width="100px" ItemStyle-CssClass="cell">
                                    <HeaderStyle Width="100px"></HeaderStyle>
                                    <ItemStyle CssClass="cell"></ItemStyle>
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="退课" ItemStyle-CssClass="operation">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%# Eval("CourseID") %>'
                                            Font-Size="Small" Text='退课' OnClick="LinkButton2_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle Font-Size="Small" Font-Underline="False" ForeColor="#CC99FF" HorizontalAlign="center" />
                        </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <br />
            <div style="margin: 10px auto auto 20px">
                <asp:LinkButton ID="LinkButton3" runat="server" 
                    PostBackUrl="~/Student/CourseDetail.aspx" Width="100px" Height="25px" >查看详细</asp:LinkButton>
            </div>
            <div style="display: none">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MSEDataBaseConnectionString %>"
                    SelectCommand="
SELECT Course.CourseID,Course.CourseName,CourseType.CategoryName FROM [MSEDataBase].[dbo].Student_Course,[MSEDataBase].[dbo].Course, [MSEDataBase].[dbo].CourseType WHERE Student_Course.CourseId = Course.CourseId  and Course.Category = CourseType.CategoryType and StudentId = @StudentId
">
                    <SelectParameters>
                        <asp:SessionParameter Name="StudentID" SessionField="StudentId" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </div>
        </div>
    </div>
    <div class="right_side">
        <div class="right_head">
            <span>
                <asp:Label ID="lbName2" runat="server" Text="Label"></asp:Label></span> 请选择你要选的课程
        </div>
        <div class="right_content">
            <table>
                <asp:DataList ID="DataList1" runat="server" DataSourceID="courseType" ForeColor="Blue"
                    Width="598px">
                    <ItemTemplate>
                        <div>
                            <tr>
                                <td align="center">
                                    <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("CategoryType") %>'
                                        Text='<%# Eval("CategoryType") %>' OnClick="LinkButton1_Click"></asp:LinkButton>
                                </td>
                                <td align="left">
                                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("CategoryName")%>'></asp:Label>
                                </td>
                            </tr>
                        </div>
                    </ItemTemplate>
                </asp:DataList>
            </table>
        </div>
        <div style="display: none">
            <asp:SqlDataSource ID="courseType" runat="server" ConnectionString="<%$ ConnectionStrings:MSEDataBaseConnectionString %>"
                SelectCommand="select * from CourseType"></asp:SqlDataSource>
        </div>
    </div>
</asp:Content>
